package com.fingard.dsp.bank.directbank.pab02.Util.api.exception;

import java.util.HashMap;

/**
 * 
 * 文件服务错误代码类
 * 
 */
public class FtpErrCode
{
	private static HashMap<String, String> errorCodeMap = new HashMap<String, String>();


	// socket 异常  序号1-10
	public final static String SoecketError = "EFS0001";
	public final static String SocketConnectError = "EFS0002";
	public final static String SocketCloseError = "EFS0003";
	public final static String SocketTimeOutError = "EFS0004";
	public final static String HttpConnectError = "EFS0005";
	
	public final static String ConnCloseError = "EFS0006";
	// 文件异常 序号11-40
	public final static String FileOperateError = "EFS0011";
	public final static String FileNotFoundError = "EFS0012";
	public final static String FileUpError = "EFS0013";
	public final static String FileDownError = "EFS0014";
	public final static String FileCloseError = "EFS0015";
	public final static String FileDeleteError = "EFS0016";
	public final static String FileRenameError = "EFS0017";
	public final static String FileCheckError = "EFS0018";
	public final static String FileReadError = "EFS0019";
	public final static String FileWriteError = "EFS0020";
	public final static String NotFileError = "EFS0021";
	public final static String FileOverSize = "EFS0022";
	public final static String FileSessionBytamper = "EFS0023";
	public final static String FileSessionOutTime = "EFS0024";
	public final static String FileTypeError = "EFS0025";

	// 转码异常 序号41-50
	public final static String ConvertFileError = "EFS0041";

	// 认证信息异常 序号51-60
	public final static String AuthUserFailed = "EFS0051";
	public final static String AuthTokenFailed = "EFS0052";
	public final static String AuthTokenisNull = "EFS0053";
	// 服务器执行异常 序号61-100
	public final static String EncryptError = "EFS0061";
	public final static String DecryptError = "EFS0062";
	public final static String LoadConfigFileError = "EFS0063";
	public final static String SaveConfigFileError = "EFS0064";
	public final static String HeadXmlError = "EFS0065";
	public final static String ExecCmdError = "EFS0066";
	public final static String TransfConnectError = "EFS0067";
	public final static String ReadReqLengthError = "EFS0068";
	public final static String AuthPrivateAuthError = "EFS0069";
	public final static String FileSessionIsNull = "EFS0070";
	public final static String FileSessionisOK = "EFS0071";
	static
	{
		// socket 异常
//
		errorCodeMap.put(SoecketError, "Socket错误");
		errorCodeMap.put(SocketConnectError, "连接服务器异常");
		errorCodeMap.put(SocketCloseError, "关闭Socket流异常");
		errorCodeMap.put(SocketTimeOutError, "Socket通讯超时出错");
		
		errorCodeMap.put(HttpConnectError, "连接服务器异常");
		
		errorCodeMap.put(ConnCloseError, "关闭连接异常");

		// 文件异常
		errorCodeMap.put(FileOperateError, "文件操作异常");
		errorCodeMap.put(FileNotFoundError, "文件不存在");
		errorCodeMap.put(FileUpError, "文件上传错误");
		errorCodeMap.put(FileDownError, "下载错误");
		errorCodeMap.put(FileCloseError, "文件关闭错误");
		errorCodeMap.put(FileDeleteError, "文件删除失败");
		errorCodeMap.put(FileRenameError, "文件重命名出错");
		errorCodeMap.put(FileCheckError, "文件Md5校验出错");
		errorCodeMap.put(FileReadError, "文件读取出错");
		errorCodeMap.put(FileWriteError, "文件写入出错");
		errorCodeMap.put(NotFileError, "路径非文件错误");
		errorCodeMap.put(FileOverSize, "文件内容长度超限");
		errorCodeMap.put(FileSessionBytamper, "文件缓存session被篡改，需要重新发起传输请求");
		errorCodeMap.put(FileSessionOutTime, "文件缓存session失效，需要重新发起传输请求");
		errorCodeMap.put(FileSessionIsNull, "文件缓存session不存在，需要重新发起传输请求");
		errorCodeMap.put(FileSessionisOK, "上传文件已经存在了，无法续传");
		errorCodeMap.put(FileTypeError, "请压缩文件");
		
		// 转码异常
		errorCodeMap.put(ConvertFileError, "转换文件出错");

		// 认证信息异常
		errorCodeMap.put(AuthUserFailed, "用户认证失败");		
		errorCodeMap.put(AuthTokenFailed, "token认证失败");		
		errorCodeMap.put(AuthTokenisNull, "token为空，请先认证用户");
		
		// 服务器执行异常
		errorCodeMap.put(EncryptError, "信息解密错误");
		errorCodeMap.put(DecryptError, "信息解密错误");
		errorCodeMap.put(LoadConfigFileError, "加载配置文件出错");
		errorCodeMap.put(SaveConfigFileError, "保存配置文件出错");
		errorCodeMap.put(HeadXmlError, "XML文件格式错误");
		errorCodeMap.put(ExecCmdError, "执行系统命令出错");
		errorCodeMap.put(TransfConnectError, "链接转发服务器异常");
		errorCodeMap.put(ReadReqLengthError, "读取请求数据长度异常");
		
		errorCodeMap.put(AuthPrivateAuthError, "私密授权码校验失败");
	}

	public static String getCodeMsg(String code)
	{
		String msg = null;
		msg = errorCodeMap.get(code);
		if (msg == null)
			msg = code;
		else
			msg = code + "-" + msg;
		return msg;
	}
}
